An electronic document, such as a webpage for a website, generally refers to one or more external resources, which may be quite large, for displaying the electronic document. For example, the electronic document may refer to image files, audio files, video files, formatting files, or other electronic document resources. Moreover, an electronic document may refer to another electronic document as an electronic document resource. In addition, a host device, such as a web server, may store the electronic document resources and, when a client device requests the electronic document, the host device may transmit the electronic document and the electronic document resources to the client device.
As transmitting the electronic resources to a client device each time the electronic document is requested may be time consuming and resource expensive, a host device may request that the client device cache the electronic resources temporarily on a computer-readable medium local to the client device. Examples of electronic document resources that may be cached by the client device include Javascript files, Cascading Style Sheets (“CSS”) files, image files, or other types of files. In general, the host device may request that the client device cache the electronic document resources by declaring the electronic document resources as external resources and using special commands in the response to the client device. For example, in the Hypertext Transfer Protocol (“HTTP”), a block of data at the beginning of the response to the client device, called a “header” may provide several functions for controlling the caching of an electronic document resource. This header is known in the art as the “Cache-Control header” and may have several different elements, called “directives”, that may specify the caching behavior. For example, the cache control directives may specify which electronic document resources should be cached, the duration of the cached electronic document resource, whether to validate the cache for the electronic document resource, and other cache control directives.
However, there are several problems with the traditional mechanism of simply declaring an electronic document resource as an external resource and relying on the use of the Cache-Control header and cache control directives. Moreover, these problems are especially exacerbated when the client device is a mobile device, such as a cellular phone, personal digital assistant, smartphone, or other mobile device. One problem is that the cache on a mobile device is typically very limited in capacity. Because a mobile device is often capacity constrained, available storage capacity is highly guarded and mobile devices often devote few resources to transient objects, like a cache. Hence, on a mobile device having a typical cache, a cached electronic resource may be replaced or removed (“flushed”) within minutes simply through use of the web browser to view electronic documents, such as web pages, requiring a high number of electronic document resources to display the electronic document, or in viewing electronic documents relying on electronic document resources that each need a large amount of the cache of the mobile device. In addition, a traditional cache may be shared among websites or web pages, and a web page or a website may inadvertently, or even intentionally, flush one or more cached electronic document resources for other websites or web pages from the cache.
Another problem is that the communication channels that a mobile device may use to communicate with a host device often have a limited amount of space (“bandwidth”) by which to transmit electronic documents and electronic document resources. Moreover, where an electronic document relies on a large number of electronic document resources, the client device and the host device may transmit a large volume of requests and responses. Because there is a delay between the time the client device requests an electronic document resource and the time the host device transmits the electronic document resource (called “latency”), a large number of requests and responses can lead to a high latency. A high latency is undesirable because it degrades the user experience of viewing the electronic document on the mobile device. Hence, a reduced latency between the mobile device and the host device would be desirable.